import { SelectionModel, TextModel } from "./../models";
import { SourceView } from "./source_view";
import { SourceAndPreview } from "./source_and_preview";
import { VIEW_TYPE } from "../constants/viewType";

export class ViewProvider {
    /**
     * @param viewMode 模式（实时渲染模式RENDER、源码分屏模式SOURCE_AND_PREVIEW、纯源码模式SOURCE、预读只读模式PREVIEW）
     * @param textModel 
     * @param selectionModel 
     * @param viewContainer 
     */
    provide (viewMode:string , textModel: TextModel, selectionModel: SelectionModel, viewContainer: HTMLElement){
        switch(viewMode){
            /**纯源码模式 */
            case VIEW_TYPE.SOURCE:
                return new SourceView(textModel , selectionModel, viewContainer);
                break;
            /**实时渲染模式 */
            case VIEW_TYPE.RENDER:
                return
                break;
            /**源码分屏模式 */
            case VIEW_TYPE.SOURCE_AND_PREVIEW:
                return new SourceAndPreview(textModel , selectionModel, viewContainer);
                break;
            /**预读只读模式 */
            case VIEW_TYPE.PREVIEW:
                return
                break;
            default:
                return new SourceView(textModel , selectionModel, viewContainer)
        }
    }
}